package com.hwadee.springboot.mapper;

import com.hwadee.springboot.entity.Student;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/**
* @author 86152
* @description 针对表【student】的数据库操作Mapper
* @createDate 2025-05-12 10:29:21
* @Entity com.hwadee.springboot.entity.Student
*/
public interface StudentMapper extends BaseMapper<Student> {

    @Select("SELECT * FROM student WHERE StudentAccount = #{username}")
    Student findByUsername(@Param("username") String username);

    @Update("UPDATE student SET Password = #{password}, Name = #{name}, Gender = #{gender}, Email = #{email}, Phone = #{phone}, Address = #{address} WHERE StudentID = #{studentId}")
    Student updateStudent(Student student);

    @Delete("DELETE FROM student WHERE StudentID = #{studentId}")
    Student deleteStudent(@Param("studentId") int studentId);
}




